package com.wtwd.device.controller;


import com.wtwd.device.constant.RespCode;
import com.wtwd.device.model.entity.LastLocationData;
import com.wtwd.device.model.vo.ResultVO;
import com.wtwd.device.service.ILastLocationDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author mjy
 * @since 2024-05-21
 */
@Api(tags = "最后一次定位模块")
@RestController
@RequestMapping("/last-location-data")
public class LastLocationDataController {


    @Resource
    private ILastLocationDataService lastLocationDataService;

    /**
     * 查询设备最后一次定位
     *
     * @param imei
     * @return
     */
    @ApiOperation("查询设备最后一次定位根据imei")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "imei", value = "imei", required = true, dataType = "String"),
    })
    @GetMapping("/queryDeviceLastLocationByImei")
    public ResultVO<LastLocationData> queryDeviceLastLocationByImei(@RequestParam String imei) {
        LastLocationData data = lastLocationDataService.getLastLocationDataByImei(imei);
        return ResultVO.success(RespCode.SUCCESS, data);
    }


}

